package Tests;

import Population.*;

public class TestGroupSize {
	boolean testConclusion = false;
	boolean[] tests = {false,false,false,false,false,false,false,false,false};
	Population p;
	
	public TestGroupSize()
	{
		p = new Population(0);
		
		p.Add(2, 1, -1);//0 1235678
		p.Add(2, 2, -1);//1 0235678
		p.Add(1, 1, -1);//2 0135678
		p.Add(1, 2, -1);//3 0125678
		p.Add(0, 4, -1);//4
		p.Add(4, 4, -1);//5 0123678
		p.Add(2, 3, -1);//6 0123578
		p.Add(3, 1, -1);//7 0123568
		p.Add(3, 3, -1);//8 0123567
		
		p.get(0).FindAssociatedNeighbors();
		p.get(1).FindAssociatedNeighbors();
		p.get(2).FindAssociatedNeighbors();
		p.get(3).FindAssociatedNeighbors();
		p.get(4).FindAssociatedNeighbors();
		p.get(5).FindAssociatedNeighbors();
		p.get(6).FindAssociatedNeighbors();
		p.get(7).FindAssociatedNeighbors();
		p.get(8).FindAssociatedNeighbors();
		
		
		/*for(int i=0; i<9; i++)
		{
			System.out.println("Associated " + i + ":" + p.get(i).getAssociatedFriends().ReportFriends());
		}*/
		
		
		if(p.get(0).getAssociatedFriends().getLength() == 7)
		{
			tests[0] = true;
		}
		
		if(p.get(1).getAssociatedFriends().getLength() == 7)
		{
			tests[1]=true;
		}
		if(p.get(2).getAssociatedFriends().getLength() == 7)
		{
			tests[2]=true;
		}
		if(p.get(3).getAssociatedFriends().getLength() == 7)
		{
			tests[3]=true;
		}
		if(p.get(4).getAssociatedFriends().getLength() == 0)
		{
			tests[4]=true;
		}
		if(p.get(5).getAssociatedFriends().getLength() == 7)
		{
			tests[5]=true;
		}
		if(p.get(6).getAssociatedFriends().getLength() == 7)
		{
			tests[6]=true;
		}
		if(p.get(7).getAssociatedFriends().getLength() == 7)
		{
			tests[7]=true;
		}
		if(p.get(8).getAssociatedFriends().getLength() == 7)
		{
			tests[8]=true;
		}
	
		
		if(GetTestsConclusion())
		{
			testConclusion = true;
		}
	}
	
	public boolean Test()
	{
		return testConclusion;
	}
	
	public boolean CheckForID(int id)
	{
		for(int i=0; i<p.getLength(); i++)
		{
			if(p.get(i).getID() == id)
				return true;
		}
		return false;
	}
	
	public boolean GetTestsConclusion()
	{
		for(int i=0; i<tests.length; i++)
		{
			if(!tests[i])
				return false;
		}
		if(tests.length > 0)
		{
			return true;
		}
		return false;
	}
	
	public boolean[] getTests()
	{
		return tests;
	}
}
